package map;

import java.util.ArrayList;
/**
 * @author tabkidsadmin
 *Comparator interface

    Comparator interface is used to order the objects of user-defined class.

    This interface is found in java.util package and contains 2 methods compare(Object obj1,Object obj2)
     and equals(Object element).

    It provides multiple sorting sequence i.e. you can sort the elements based on any data member.
     For instance it may be on rollno, name, age or anything else. 
 *
 */

public class ComparatorDemo {
	/*
	 * Syntax of compare method

       public int compare(Object obj1,Object obj2): compares the first object with second object.
------------------->Important <-----------------
       Collections class provides static methods for sorting the elements of collection.
        If collection elements are of Set type, we can use TreeSet. But We cannot sort the elements of List.
        Collections class provides methods for sorting the elements of List type elements.
	 */
	public static void main(String[] args) {
		ArrayList al = new ArrayList(); 
		//public void sort(List list,Comparator c): is used to sort the elements of List by the given comparator.
	}

}
